﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Test_paypal.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="js/jquery-1.8.3.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <asp:HiddenField ID="HiddenField2" runat="server" />
    </div>
    </form>
    <div id="fz">
    </div>

      <script type="text/javascript">
          $(function () {
              var ten = document.getElementById("<%=HiddenField1.ClientID%>").value;
              var gia = document.getElementById("<%=HiddenField2.ClientID%>").value;

              alert(ten + " " + gia);

              var form = $("<form/>",
                 {
                     action: 'https://www.sandbox.paypal.com/cgi-bin/webscr',
                     method: 'post'
                 }
            );
              form.append
                (
                         $("<input/>",
                             {
                                 type: 'hidden',
                                 name: 'cmd',
                                 value: '_xclick'

                             }
                           )

                );

              form.append
                (
                         $("<input/>",
                             {
                                 type: 'hidden',
                                 name: 'business',
                                 value: 'nguoimua_@gmail.com'

                             }
                           )

                );
              form.append
                (
                         $("<input/>",
                             {
                                 type: 'hidden',
                                 name: 'item_name',
                                 value: ten

                             }
                           )

                );

              form.append
                (
                         $("<input/>",
                             {
                                 type: 'hidden',
                                 name: 'amount',
                                 value: gia

                             }
                           )

                );
              form.append
                (
                         $("<input/>",
                             {
                                 type: 'submit',

                                 value: 'BUY'

                             }
                           )

                );
              $('#fz').append(form);
          })
    </script>
</body>
</html>
